Skip to content

fix(pm-stack): rung-4 escalation speaks the validated queue contract (#6033) - #11268

Merged
dezren39 merged 2 commits into
mainfrom
queue/20118-6033-rung4-wiring
Nov 17, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/20118-6033-rung4-wiring

Conversation

@dezren39

@dezren39 dezren39 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What

Wires rung-4 escalation into the fleet queue's validated contract so a live escalation actually creates its hand-off (task 20118, remainder of #6033).

The watchdog core from PR #11243 already calls planEscalation / planRecovery with production effectors — but the production enqueueTask wrapper was not a valid repo-task/v1 packet. Proven against the live validator before this change:

$ fleet queue validate <old wrapper>
error: payload.repo: None is not a fleet repo
error: payload.problem: required field missing or empty
error: payload.priority_reason: required field missing or empty
error: payload.evidence: must be a list
error: payload.acceptance: must be a list
error: payload.tests: must be a list
error: payload.context_refs: must be a list
error: payload.scope: must be an object with include/exclude
error: payload.risk.level: must be low|medium|high
error: payload.timebox_minutes: must be a positive integer
error: payload.dedupe: must have checked_at and basis as non-empty strings
error: payload identity: need issue.number, a non-empty prs list, a set object, or a pre-filing source {pr, finding}
error: packet.dedupe_key: 'watchdog-escalation:fixture:session-expired' matches no design pattern

Since enqueue ran first in the plan, a live escalation created neither the queue task nor the incident issue — the exact failure mode of the 2026-11-13→16 Mistral outage, one layer down.

Changes

  • Issue-first hand-off: planEscalation now plans open_issue before enqueue_task — a small_fix packet's fix-family dedupe key (repo-health:v1:fix:<repo>:issue:<n>) must name an existing issue, with payload.issue.number matching.
  • buildQueueTaskWrapper (new, pure, in watchdog-escalation.ts): translates an escalation packet into the validated repo-task/v1 envelope — fix-family dedupe key, payload identity, problem/evidence/acceptance/tests/context/scope/risk/timebox/dedupe all populated from the packet, and the full escalation packet riding in payload.escalation_packet so a browser-enabled agent can start from the claimed task alone.
  • applyEscalationActions stamps the issue number confirmed earlier in the same run into the enqueue packet; a partial-resume packet carries its recorded number from the escalation record.
  • Partial-failure semantics mirrored: a failed enqueue now surfaces the confirmed issue number via EscalationPartialError, and the retry plans only the missing task.
  • Production enqueueTask in watchdog.ts uses the wrapper builder (throws on a number-less packet instead of enqueueing an invalid one).

Tests

Refs #6033. Filed from queue task 20118 (lane any-l).

Live fixture demonstration (this branch, production effectors, 2026-11-17)

Two full cycles through the real CLI entry point (bun src/watchdog.ts, QUOTA_WATCHDOG_LIVE=1, fixture adapter, scratch state tree):

  • Escalation: after the ladder walk (rung attempts 1×2, 2×2, 3×2), tick 7 created exactly one incident issue and one queue task — cycle 1: issue watchdog incident: fixture quota producer failing (unknown) #11269 + task 20753; cycle 2: issue watchdog incident: fixture quota producer failing (unknown) #11271 + task 20754 (status: queued, dedupe_key: repo-health:v1:fix:developing-today/code:issue:11271, verified in the queue DB).
  • Dedupe: a further failing tick changed neither ref (same since, same ids) and created nothing.
  • Recovery: a healthy tick auto-commented ("Recovered: source fixture produced a fresh document…") and auto-closed the incident issue, and cleared the incident from the state file.
  • Cycle 1 exposed the recovery-completion gap fixed in the second commit: the queue task stayed queued because complete requires holding a claim. Cycle 2's recovery cancelled task 20754 itself with the recovery reason (verified in the queue DB). Cycle 1's leftover task 20753 was cancelled with the same reason by hand.
  • Human-blocked surfacing is covered at tick level (the entry-point test marks the incident human-blocked and emits the NEEDS DREW line the same tick); a live browser challenge cannot be fixtured without a browser.

…6033)

The watchdog core (PR #11243) wires watchdog-escalation.ts into the live tick, but the production enqueueTask wrapper was not a valid repo-task/v1 packet: fleet queue validate rejects it on 13 fields (no payload.repo/problem/evidence/acceptance/tests/context_refs/scope/risk/timebox/dedupe, no payload identity, dedupe_key matching no design pattern). Since enqueue ran first, a live escalation created neither the queue task nor the incident issue.

Fix: create the incident issue first (a small_fix packet's fix-family dedupe key must name an existing issue), stamp the confirmed issue number into the enqueue packet in applyEscalationActions, and translate the packet through the new pure buildQueueTaskWrapper (fix-family dedupe key, payload.issue.number, full escalation context in payload.escalation_packet). Partial-hand-off resume keeps its semantics, mirrored: a failed enqueue now surfaces the confirmed issue number and the retry plans only the missing task, whose packet carries the recorded number.

Tests: exporters suite 39 pass (plan order, apply stamping, wrapper contract, resume packet, flipped partial-failure case, tick-level issue-before-enqueue assertion). The generated wrapper passes the real validator: packet valid (repo-task/v1).
@dezren39
dezren39 requested a review from a team as a code owner November 17, 2026 11:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-17T12:01:17.422480Z
We couldn’t complete this review. Comment @codex review to try again.
7ae86e8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99b9df4c-78df-46c2-b4b2-3e024ee04579
Commits

Reviewing files that changed from the base of the PR and between a4a5fe6 and 7ae86e8.

Files selected for processing: 5

  • pm-stack/exporters/README.md
  • pm-stack/exporters/src/watchdog-escalation.ts
  • pm-stack/exporters/src/watchdog.ts
  • pm-stack/exporters/test/watchdog-escalation.test.ts
  • pm-stack/exporters/test/watchdog.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…sk (#6033)

Live fixture demo (task 20118): recovery auto-commented and auto-closed the incident issue, but the queue task stayed queued — complete requires holding the claim and the watchdog never claims, so its best-effort complete always fails for a still-queued task (the common case: the source healed before a fixer picked the task up).

completeTask now falls back, only when the task is untouched (no timeline records — an unclaimed task has none), to cancel with the recovery reason. A task with timeline records has an owner and is left to them; the auto-closed incident issue is their signal.
@dezren39

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

Codex gate disposition (task 20118): the Codex review on this PR failed to run — "You have reached your Codex usage limits for code reviews" (initial run on 9d49f53 and again on the @codex review retrigger). There are zero Codex findings on this PR to disposition (no inline comments, no review body). CodeRabbit likewise rate-limited without findings. Merge proceeds on the strength of the exporters suite (39 pass), the real-validator proof, and two live fixture cycles; if Codex reviews the merged commit later and surfaces findings, they will be fixed forward.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits. You can see your limits in the Codex usage dashboard.

@dezren39
dezren39 merged commit 6fe4d6d into main Nov 17, 2026
1 check passed
@dezren39
dezren39 deleted the queue/20118-6033-rung4-wiring branch November 17, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant